package pkg

import (
	"fmt"
	"github.com/robfig/cron"
	"month6/common/model/mysql"
)

func Cron(OrderSn string) {
	c := cron.New()
	spec := "0 */15 * * * ?"
	c.AddFunc(spec, func() {
		o := mysql.Order{}
		err := o.FindUpdated2(OrderSn)
		if err != nil {
			fmt.Println("订单 15 分钟内未完成支付,已取消订单")
			return
		}
	})

	c.Start()

	select {}
}
